#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;
class Point {
private:
	double x, y;
public:
	Point();
	Point(double x1, double x2);
	double getX();
	double getY();
	void setXY(double x1,double y1);
	void setX(double x_value);
	void setY(double y_value);
	double getDisTo(const Point& p);
	~Point();
};
Point::Point() {
	x = 0;
	y = 0;
	cout << "Constructor." << endl;
}
Point::Point(double x_value,double y_value) {
	x = x_value;
	y = y_value;
	cout << "Constructor." << endl;
}
double Point::getX() {
	return x;
}
double Point::getY() {
	return y;
}
void Point::setXY(double x1,double y1) {
	x = x1;
	y = y1;

}
void Point::setX(double x_value) {
	x = x_value;
}
void Point::setY(double y_value) {
	y = y_value;
}
double Point::getDisTo(const Point &p) {
	return pow(pow(x-p.x,2)+pow(y-p.y,2), 0.5);
}
Point::~Point(){
	cout << "Distructor." << endl;
}
int main()
{
	int t;
	cin >> t;
	for (int i = 0; i < t; i++) {
		int n;
		cin >> n;
		Point* arr = new Point[n];
		double x, y;
		for (int j = 0; j < n; j++) {
			cin >> x >> y;
			(arr + j)->setXY(x, y);
		}
		double max = 0;
		for (int j = 0; j < n; j++) {
			for (int k = j + 1; k < n; k++) {
				if ((arr + j)->getDisTo(*(arr + k)) > max) {
					x = j;
					y = k;
					max = (arr + j)->getDisTo(*(arr + k));
				}
			}
		}
		cout << "The longeset distance is ";
		cout << fixed << setprecision(2) << max;
		cout << ",between p[" << (int)x << ']' << " and p[" << (int)y << "]." << endl;
		delete[] arr;
	}
	return 0;
}